;
(function() {
    function _mix(sObj, nObj) {
        var obj_n,
            obj_s,
            i;
        if (sObj instanceof Object && nObj instanceof Object) {
            for (var i in nObj) {
                if (nObj.hasOwnProperty(i)) {
                    obj_n = nObj[i];
                    obj_s = sObj[i]; //||(sObj[i]={});
                    if (obj_s !== obj_n) { //避免循环 Avoid Circular
                        sObj[i] = _mix(obj_s, obj_n);
                    }
                }
            }
            var nojson_able_keys = sObj.nojson_able_keys;
            if (nojson_able_keys instanceof Array) {
                Object.defineProperty(nObj, "nojson_able_keys", {
                    enumerable: false,
                    value: nojson_able_keys
                });
            }
            return sObj;
        } else {
            return nObj;
        }
    }
    module.exports = {
        clone: function(obj) {
            var sobj = obj instanceof Array ? [] : {};
            return _mix(sobj, obj);
        },
        mix: _mix,
        extend: function(instance, extendObj) {
            var instance_proto = instance.__proto__;
            instance = this.clone(instance);
            var new_proto = Object.create(instance_proto);
            Object.keys(extendObj).forEach(function(key) {
                new_proto[key] = extendObj[key];
            });
            instance.__proto__ = new_proto;
            return instance;
        },
        hasValue: function(obj, value) {
            if (typeof obj === "object") {
                for (var i in obj) {
                    if (obj.hasOwnProperty(i) && obj[i] === value) {
                        return true
                    }
                }
            }
            return false;
        }
    }
}());